import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
//导入axios对象，配置Vue原型
import axios from "./utils/request";
Vue.prototype.$axios = axios;
// 配置element-ui
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);
//配置echarts 
import * as echarts from "echarts";
Vue.prototype.$echarts = echarts;
Vue.config.productionTip = false
// 配置vantul
import Vant from 'vant';
import 'vant/lib/index.css';

Vue.use(Vant);
router.beforeEach((to, from, next) => {
  if (to.path == "/admin/login") {
    if (store.state.gq_token != "") {
      next("/admin/gqhome")
    }
  } else {
    if (store.state.gq_token == "") {
      next("/admin/login")
    }
  }
  next()
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
